#include <cstdio>
#include <string>
#include <iostream>
using namespace std;
const int maxl=10;
string mid,post;
void solve(int lmid,int rmid,int lpost,int rpost){	//[left,right)
	printf("%c",post[rpost-1]);
	int p=mid.find(post[rpost-1]);
	if(p>lmid) solve(lmid,p,lpost,lpost+p-lmid);
	if(p+1<rmid) solve(p+1,rmid,lpost+p-lmid,rpost-1);
}
int main(){
	cin>>mid>>post;
	solve(0,mid.size(),0,post.size()); printf("\n");
	return 0;
}

